Guest User

Untitled

a guest
Nov 5th, 2011
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5.  
  6. double sumowanie(int n){
  7. int i;
  8. double suma = 0;
  9.  
  10. for(i=1;i<=n;i++)
  11. suma = suma + 1/(double)i;
  12. return suma;
  13. }
  14.  
  15. int main () {
  16. int C,n;
  17. printf("Podaj n \n");
  18. scanf("%d",&n);
  19. double wynik = sumowanie(n);
  20. printf("wynik=%lf \n",wynik);
  21.  
  22. C = (int)sumowanie(n) + 1;
  23. printf("%d \n",C);
  24.  
  25.  
  26. system ("PAUSE");
  27. return 0;
  28. }
  29.  
  30.  
Advertisement
Add Comment
Please, Sign In to add comment